import { http } from "../plugins/axios"
import utils from "@/utils";
import {CacheEnum} from "@/enum/userEnum"


//获取当前用户的博客信息

function getBokBySelf(pageNum:any,u_id:any){
    return http.request({
        url:'getSelfBok',
        method:'get',
        params:{pageNum:pageNum,u_id:u_id},
        headers: {token:utils.store.get(CacheEnum.TOKEN_NAME)},
    })
}


//获取当前的用户头像

function getCurrentPeopleByUid(u_id:any){
    return http.request({
        url:'getCurrentPeopleByUid',
        method: 'GET',
        params:{u_id:u_id},
        headers: {token:utils.store.get(CacheEnum.TOKEN_NAME)},
    })

}

//点击关注
function  clickAttention(currentId:any,attentionId:any){
     return http.request({
        url:'clickAttention',
        method:'get',
        params:{currentId:currentId,attentionId:attentionId},
        headers: {token:utils.store.get(CacheEnum.TOKEN_NAME)},
     })

    }

 //看当前用户是否关注当前博主
 function isAttention(currentId:any,attentionId:any){
    return http.request({
        url:'isAttention',
        method:'get',
        params:{currentId:currentId,attentionId:attentionId},
        headers: {token:utils.store.get(CacheEnum.TOKEN_NAME)},
     })  
 }   

 //点击收藏
 function clickCollection(currentId:any,attentionId:any){
      return http.request({
        url:'clickCollection',
        method:'get',
        params:{currentId:currentId,attentionId:attentionId},
        headers: {token:utils.store.get(CacheEnum.TOKEN_NAME)},
      })
 }

 //是否收藏当前的博客
 function isCollection(currentId:any,attentionId:any){
    return http.request({
        url:'isCollection',
        method:'get',
        params:{currentId:currentId,attentionId:attentionId},
        headers: {token:utils.store.get(CacheEnum.TOKEN_NAME)},
     })  
 }

 //获取用户收藏的博客
  function getCollentionBok(pageNum:any,u_id:any){
    return http.request({
        url:'getCollentionBok',
        method:'get',
        params:{pageNum:pageNum,u_id:u_id},
        headers: {token:utils.store.get(CacheEnum.TOKEN_NAME)},
     })  
  }

  //获取关注的列表
  function getAttention(pageNum:any,u_id:any){
    return http.request({
      url:'getAttention',
      method:'get',
      params:{pageNum:pageNum,u_id:u_id},
      headers: {token:utils.store.get(CacheEnum.TOKEN_NAME)},
    })
  }


  //获取粉丝
 function getFans(pageNum:any,u_id:any){
   return http.request({
   
      url:'getFans',
      method:'get',
      params:{pageNum:pageNum,u_id:u_id},
      headers: {token:utils.store.get(CacheEnum.TOKEN_NAME)},
  
   }) 
 }

    //删除当前博客的帖子
    function deletebokBybid(b_id:any){
      return http.request({
      
         url:'deletebokBybid',
         method:'get',
         params:{b_id:b_id},
         headers: {token:utils.store.get(CacheEnum.TOKEN_NAME)},
     
      })
       
    
     }
export default {getBokBySelf,getCurrentPeopleByUid,clickAttention
    ,isAttention,clickCollection,isCollection,getCollentionBok,getAttention,getFans,deletebokBybid}